import roleService from "./roleService.js";

const roleController = {
  async addRole(ctx, next) {
    let {username, password} = ctx.request.body;
    ctx.body = await roleService.addRole(username, password)
  },

  async delRole(ctx, next) {
    let {id} = ctx.request.body;
    ctx.body = await roleService.delRole(id);
  },

  async getRole(ctx, next) {
    let {username, password} = ctx.request.body;
    ctx.body = await roleService.getRole(username);
  },

  async getRoleByOrg(ctx, next) {
    let {username, password} = ctx.request.body;
    ctx.body = await roleService.getRoleByOrg(username);
  },
  async getUserByRole(ctx, next) {
    let {name} = ctx.request.body
    ctx.body = await roleService.getUserByRole(name);
  }

}
export default roleController;